import { defineConfig } from 'vite'
import {resolve} from 'path'
import vue from '@vitejs/plugin-vue'
import configArcoResolverPlugin from './configPlugs/arcoResolver';
import configArcoStyleImportPlugin from './configPlugs/arcoStyleImport';


const __dirname = resolve();

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    vue(),
    configArcoResolverPlugin(),
    configArcoStyleImportPlugin()
  ],
  // build: {
  //     emptyOutDir: true,
  //     rollupOptions: {
  //       output: {
  //         manualChunks: {
  //           arco: ['@arco-design/web-vue'],
  //           vue: ['vue', 'vue-router', 'pinia', '@vueuse/core', 'vue-i18n'],
  //         },
  //       },
  //     },
  //     chunkSizeWarningLimit: 2000,
  //   },
  resolve: {
    alias: [
      {
        find: '@',
        replacement: resolve(__dirname, './src'),
      },
      {
        find: 'assets',
        replacement: resolve(__dirname, './src/assets'),
      },
      {
        find: 'vue-i18n',
        replacement: 'vue-i18n/dist/vue-i18n.cjs.js', // Resolve the i18n warning issue
      },
      {
        find: 'vue',
        replacement: 'vue/dist/vue.esm-bundler.js', // compile template
      },
    ],
    extensions: ['.ts', '.js'],
  },
})
